<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script
  src="https://code.jquery.com/jquery-2.2.4.min.js"
  integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
  crossorigin="anonymous"></script>
</head>
<body>
    <h2>
        demo
    </h2>
    <p>
        <a href="https://www.baidu.com" target="_blank">百度</a>
        <button id="btn">close</button>
        <a href="javascript:window.opener=null;window.open('','_self');window.close();">关闭</a>
    </p>
    <script>
        $(function(){
            $("#btn").bind("click",function(){
                window.close();
            });
        });
    </script>
</body>
</html>